﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ProjectNocturnalFool
{
    static class TileImage
    {
        static public Texture2D imageSheet;
        static public int tileImageWidth = Constants.tileImageW;
        static public int tileImageHeight = Constants.tileImageH;

        static private int _tileImageStepX = 64;
            static public int tileImageStepX { get { return (int)(_tileImageStepX*Camera.scale);} set {;} }
        static private int _tileImageStepY = 16;
            static public int tileImageStepY { get { return (int)(_tileImageStepY*Camera.scale);} set { ;} }
        static private int _oddRowXOffset = 32;
            static public int oddRowXOffset { get { return (int)(_oddRowXOffset * Camera.scale); } set { ; } }
        static private int _heightTileImageOffset = 32;
            static public int heightTileImageOffset {get { return (int)(_heightTileImageOffset*Camera.scale);} set { ; } }

        static public Vector2 originPoint = new Vector2(19, 39);

        static public Rectangle GetSourceRectangle(int tileImageIndex)
        {
            int tileImageY = tileImageIndex / (imageSheet.Width / tileImageWidth);
            int tileImageX = tileImageIndex % (imageSheet.Width / tileImageWidth);

            return new Rectangle(tileImageX * tileImageWidth, tileImageY * tileImageHeight, tileImageWidth, tileImageHeight);
        }
    }
}